﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ReconSite.Master" AutoEventWireup="true" CodeBehind="RoleMaster.aspx.cs" Inherits="ReconUI.RoleMaster" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyHolder" runat="server">

    <div class="formDiv" style="width:45%">	
    <h2 class="formTitle">Role Master</h2>
    <h1 class="formError" style="text-align:right;font-size:smaller;color:#CC2900;">Fields marked with * are mandatory</h1>	
    <table cellspacing="1" cellpadding="1" border="0" width="100%">
        
        <tr>
            <td align="right">
                Option<span class="required">*</span>
            </td>
            <td colspan="3">
             <asp:RadioButtonList ID="rbOption" runat="server" RepeatDirection="Horizontal" 
                    RepeatLayout="Flow" AutoPostBack="True" 
                    onselectedindexchanged="rbOption_SelectedIndexChanged">
                    <asp:ListItem Value="1" Selected="True">Add</asp:ListItem>
                    <asp:ListItem Value="2">Modify</asp:ListItem>
                    </asp:RadioButtonList>             
            </td>
        </tr>
        <tr>
            <td align="right">
                Role Code<span class="required">*</span>
            </td>
            <td colspan="3">
                <input id="txtRoleCode" style="width: 125px" type="text" runat="server" 
                    enableviewstate="True" MaxLength="4"  />
                <asp:Button ID="bntbrowse" runat="server" Text="..." Width="25px"   OnClick="bntbrowse_Click" CausesValidation="False" />
                <asp:Button ID="bntgetdetails" runat="server" Text="Get Details" OnClick="bntgetdetails_Click" CausesValidation="False" OnClientClick="javascript:return SelectUser();" />
                <asp:RequiredFieldValidator ID="reqRoleCode" runat="server" 
                    ErrorMessage="Role Code is Mandatory" CssClass="formError"
                    ControlToValidate="txtRoleCode" InitialValue="" 
                    SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regRoleCode" runat="server" 
                    ControlToValidate="txtRoleCode" CssClass="formError"
                    ErrorMessage="Invalid Role Code" ValidationExpression="^[a-zA-Z0-9]+$" 
                    SetFocusOnError="True"></asp:RegularExpressionValidator>
            </td>
        </tr>
        
        <tr>
            <td align="right">
                Role Description<span class="required">*</span>
            </td>
            <td colspan="3">
                <asp:TextBox ID="txtRoleDesc" runat="server" MaxLength="50"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="reqtxtRoleDesc" runat="server" ControlToValidate="txtRoleDesc"
                       ErrorMessage="Role Description is mandatory" SetFocusOnError="True" CssClass="formError"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="regtxtRoleDesc" runat="server" ControlToValidate="txtRoleDesc"
                        EnableViewState="False" ErrorMessage="Invalid Role Description" SetFocusOnError="True"
                        ValidationExpression="^[A-Za-z0-9' '.]{0,50}$" CssClass="formError"></asp:RegularExpressionValidator>
            </td>
        </tr>
        
        <tr>
            <td align="right">
                Role Type<span class="required">*</span>
            </td>
            <td colspan="3">
                <asp:DropDownList ID="ddlRoleType" runat="server" AutoPostBack="False">
                    <asp:ListItem Value="0">Please Select</asp:ListItem>
                    <asp:ListItem Value="C">Customer</asp:ListItem>
                    <asp:ListItem Value="R">Remitter</asp:ListItem>
                    <asp:ListItem Value="S">System</asp:ListItem>
                    <asp:ListItem Value="CU">Corporate User</asp:ListItem>
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="reqRoleType" runat="server" 
                    ErrorMessage="Role Type is Mandatory" CssClass="formError"
                    ControlToValidate="ddlRoleType" InitialValue="0" 
                    SetFocusOnError="True"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td align="right">                
            </td>
            <td colspan="3">
                <asp:CheckBox ID="chkEnable" runat="server" Text="Enable" Checked="True" />
            </td>
        </tr>
        
        <tr>
            <td align="right">
            </td>
            <td colspan="3">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
                <asp:Button ID="btnCancel" runat="server" Text="Reset" CausesValidation="False" OnClick="btnCancel_Click" />
            </td>
        </tr>
    </table>
    
  <asp:UpdatePanel ID="upUnmatchedLists" runat="server" UpdateMode="Conditional">
        <ContentTemplate>    
                <div id="pnlMatchList" runat="server" class="pnlMatchList">    
                    <span style="azimuth: center;">
                        <div class="formDiv" runat ="server"  >
                            <center>
                                <asp:Label ID="lblMessage" runat="server"    CssClass="lable"/>
                            </center>
                        </div>
                    </span>
                    <div class="formDiv" style="width: 30%;">
                         <center>
                            <asp:Button ID="btnok" runat="server" Text="OK" onclick="btnok_Click" CausesValidation="False"  />
                          </center>
                    </div>
                </div>
            <div style="display: none">
                <asp:Button ID="btnManualPopup" runat="server" />
            </div>
            <ajax:ModalPopupExtender ID="btnClickPopup" runat="server" PopupControlID="pnlMatchList"
                TargetControlID="btnManualPopup" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowScroll" OkControlID = "btnok">
            </ajax:ModalPopupExtender>   
        </ContentTemplate>        
    </asp:UpdatePanel>


    </div>


     <script type="text/javascript">


         function SelectUser() {
             var Username = document.getElementById('<%=txtRoleCode.ClientID %>').value;
             if (Username == '') {
                 alert("Role Code is Mandatory");
                 return false;
             }

             return true;
         }
    </script>
</asp:Content>
